<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 自定义iterator迭代器
        let person = {
            name: 'js',
            status: [
                'wait',
                'todo',
                'done'
            ],
            [Symbol.iterator]() {
                let index = 0;

                return {
                    next: () => {
                        return {
                            value: this.status[index],
                            done: ++index && this.status.length < index
                        }
                    }
                }
            }
        }

        // Uncaught TypeError: person is not iterable
        for (let p of person) { 
            console.log(p)
        }


    </script>
</body>
</html>